﻿<?php require_once('../Connections/hitekforyou.php'); ?>
<?php
require_once('checklogin.php');
error_reporting(0);
// Load the common classes
require_once('../includes/common/KT_common.php');

// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');

// Load the KT_back class
require_once('../includes/nxt/KT_back.php');

// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("../");

// Make unified connection variable
$conn_hitekforyou = new KT_connection($hitekforyou, $database_hitekforyou);

// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("NickYH", true, "text", "", "", "", "Vui lòng điền đúng dữ liệu cần");
$tNGs->prepareValidation($formValidation);
// End trigger

// Make an insert transaction instance
$ins_tuvanonline = new tNG_multipleInsert($conn_hitekforyou);
$tNGs->addTransaction($ins_tuvanonline);
// Register triggers
$ins_tuvanonline->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_tuvanonline->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_tuvanonline->registerTrigger("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.php");
// Add columns
$ins_tuvanonline->setTable("tuvanonline");
$ins_tuvanonline->addColumn("NickYH", "STRING_TYPE", "POST", "NickYH");
$ins_tuvanonline->setPrimaryKey("idTVO", "NUMERIC_TYPE");

// Make an update transaction instance
$upd_tuvanonline = new tNG_multipleUpdate($conn_hitekforyou);
$tNGs->addTransaction($upd_tuvanonline);
// Register triggers
$upd_tuvanonline->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1");
$upd_tuvanonline->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$upd_tuvanonline->registerTrigger("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.php");
// Add columns
$upd_tuvanonline->setTable("tuvanonline");
$upd_tuvanonline->addColumn("NickYH", "STRING_TYPE", "POST", "NickYH");
$upd_tuvanonline->setPrimaryKey("idTVO", "NUMERIC_TYPE", "GET", "idTVO");

// Make an instance of the transaction object
$del_tuvanonline = new tNG_multipleDelete($conn_hitekforyou);
$tNGs->addTransaction($del_tuvanonline);
// Register triggers
$del_tuvanonline->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Delete1");
$del_tuvanonline->registerTrigger("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.php");
// Add columns
$del_tuvanonline->setTable("tuvanonline");
$del_tuvanonline->setPrimaryKey("idTVO", "NUMERIC_TYPE", "GET", "idTVO");



// Make a logout transaction instance
$logoutTransaction = new tNG_logoutTransaction($conn_hitekforyou);
$tNGs->addTransaction($logoutTransaction);
// Register triggers
$logoutTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "GET", "KT_logout_now");
$logoutTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "login.php");
// Add columns
// End of logout transaction instance

// Execute all the registered transactions
$tNGs->executeTransactions();

// Get the transaction recordset
$rstuvanonline = $tNGs->getRecordset("tuvanonline");
$row_rstuvanonline = mysql_fetch_assoc($rstuvanonline);
$totalRows_rstuvanonline = mysql_num_rows($rstuvanonline);

// Get the transaction recordset
$rscustom = $tNGs->getRecordset("custom");
$row_rscustom = mysql_fetch_assoc($rscustom);
$totalRows_rscustom = mysql_num_rows($rscustom);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="quantri.css" rel="stylesheet" type="text/css" />
<script src="../AC_RunActiveContent.js" type="text/javascript"></script>

<title>Quản trị web HitekForYou</title>
<link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="../includes/common/js/base.js" type="text/javascript"></script>
<script src="../includes/common/js/utility.js" type="text/javascript"></script>
<script src="../includes/skins/style.js" type="text/javascript"></script>
<?php echo $tNGs->displayValidationRules();?>
<script src="../includes/nxt/scripts/form.js" type="text/javascript"></script>
<script src="../includes/nxt/scripts/form.js.php" type="text/javascript"></script>
<script type="text/javascript">
$NXT_FORM_SETTINGS = {
  duplicate_buttons: true,
  show_as_grid: true,
  merge_down_value: true
}
</script>
</head>

<body>

<?php include("admin_template/header.php"); ?>
<?php include("admin_template/admin_banner.php"); ?> 
<table id="main" width="990" border="1" align="center" cellpadding="0" cellspacing="0">
 <tr>
    <td width="200" align="left" valign="top" bgcolor="#66CC00" id="cottrai">
      <div align="left">
      <?php include("menu.php"); ?>  
      </div>       </td>
    <td id="cotphai" width="790" align="left" valign="top" bgcolor="#CCFF00">
     
  
   
    <?php
	echo $tNGs->getErrorMsg();
?>
    <div class="KT_tng">
      <h1>
        <?php 
// Show IF Conditional region1 
if (@$_GET['idTVO'] == "") {
?>
Thêm
          <?php 
// else Conditional region1
} else { ?>
    Cập nhật
          <?php } 
// endif Conditional region1
?>
        Tư vấn online </h1>
      <div class="KT_tngform">
        <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
          <?php $cnt1 = 0; ?>
          <?php do { ?>
            <?php $cnt1++; ?>
            <?php 
// Show IF Conditional region1 
if (@$totalRows_rstuvanonline > 1) {
?>
              <h2><?php echo NXT_getResource("Record_FH"); ?> <?php echo $cnt1; ?></h2>
              <?php } 
// endif Conditional region1
?>
            <table cellpadding="2" cellspacing="0" class="KT_tngtable">
              <tr>
                <td class="KT_th"><label for="NickYH_<?php echo $cnt1; ?>">Nick yahoo:</label></td>
                <td><input type="text" name="NickYH_<?php echo $cnt1; ?>" id="NickYH_<?php echo $cnt1; ?>" value="<?php echo KT_escapeAttribute($row_rstuvanonline['NickYH']); ?>" size="40" maxlength="255" />
                    <?php echo $tNGs->displayFieldHint("NickYH");?> <?php echo $tNGs->displayFieldError("tuvanonline", "NickYH", $cnt1); ?> </td>
              </tr>
            </table>
            <input type="hidden" name="kt_pk_tuvanonline_<?php echo $cnt1; ?>" class="id_field" value="<?php echo KT_escapeAttribute($row_rstuvanonline['kt_pk_tuvanonline']); ?>" />
            <?php } while ($row_rstuvanonline = mysql_fetch_assoc($rstuvanonline)); ?>
          <div class="KT_bottombuttons">
            <div>
              <?php 
      // Show IF Conditional region1
      if (@$_GET['idTVO'] == "") {
      ?>
                <input type="submit" name="KT_Insert1" id="KT_Insert1" value="Thêm" />
                <?php 
      // else Conditional region1
      } else { ?>
                <div class="KT_operations">
                  <input type="submit" name="KT_Insert1" value="Thêm mới" onclick="nxt_form_insertasnew(this, 'idTVO')" />
                </div>
                <input type="submit" name="KT_Update1" value="Cập nhật" />
                <input type="submit" name="KT_Delete1" value="Xóa" onclick="return confirm('<?php echo NXT_getResource("Bạn có chắc muốn xóa ?"); ?>');" />
                <?php }
      // endif Conditional region1
      ?>
              <input type="button" name="KT_Cancel1" value="Hủy" onclick="return UNI_navigateCancel(event, '../includes/nxt/back.php')" />
            </div>
          </div>
        </form>
      </div>
      <br class="clearfixplain" />
    </div>
    <p>&nbsp;</p>
    </tr>
</table>
<?php include("admin_template/footer.php"); ?>  
</body>
</html>

